import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/duty/duty_schedule_config_entity.dart';
import 'package:safetymonitor/app/data/common/choice_bean.dart';


DutyScheduleConfigEntity $DutyScheduleConfigEntityFromJson(Map<String, dynamic> json) {
  final DutyScheduleConfigEntity dutyScheduleConfigEntity = DutyScheduleConfigEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    dutyScheduleConfigEntity.id = id;
  }
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    dutyScheduleConfigEntity.companyId = companyId;
  }
  final String? companyName = jsonConvert.convert<String>(json['companyName']);
  if (companyName != null) {
    dutyScheduleConfigEntity.companyName = companyName;
  }
  final String? scheduleName = jsonConvert.convert<String>(json['scheduleName']);
  if (scheduleName != null) {
    dutyScheduleConfigEntity.scheduleName = scheduleName;
  }
  final String? scheduleType = jsonConvert.convert<String>(json['scheduleType']);
  if (scheduleType != null) {
    dutyScheduleConfigEntity.scheduleType = scheduleType;
  }
  final String? scheduleTypeCode = jsonConvert.convert<String>(json['scheduleTypeCode']);
  if (scheduleTypeCode != null) {
    dutyScheduleConfigEntity.scheduleTypeCode = scheduleTypeCode;
  }
  final String? dutyStartTime = jsonConvert.convert<String>(json['dutyStartTime']);
  if (dutyStartTime != null) {
    dutyScheduleConfigEntity.dutyStartTime = dutyStartTime;
  }
  final String? dutyEndTime = jsonConvert.convert<String>(json['dutyEndTime']);
  if (dutyEndTime != null) {
    dutyScheduleConfigEntity.dutyEndTime = dutyEndTime;
  }
  final String? totalDuration = jsonConvert.convert<String>(json['totalDuration']);
  if (totalDuration != null) {
    dutyScheduleConfigEntity.totalDuration = totalDuration;
  }
  final int? createTime = jsonConvert.convert<int>(json['createTime']);
  if (createTime != null) {
    dutyScheduleConfigEntity.createTime = createTime;
  }
  return dutyScheduleConfigEntity;
}

Map<String, dynamic> $DutyScheduleConfigEntityToJson(DutyScheduleConfigEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['companyId'] = entity.companyId;
  data['companyName'] = entity.companyName;
  data['scheduleName'] = entity.scheduleName;
  data['scheduleType'] = entity.scheduleType;
  data['scheduleTypeCode'] = entity.scheduleTypeCode;
  data['dutyStartTime'] = entity.dutyStartTime;
  data['dutyEndTime'] = entity.dutyEndTime;
  data['totalDuration'] = entity.totalDuration;
  data['createTime'] = entity.createTime;
  return data;
}

extension DutyScheduleConfigEntityExtension on DutyScheduleConfigEntity {
  DutyScheduleConfigEntity copyWith({
    int? id,
    int? companyId,
    String? companyName,
    String? scheduleName,
    String? scheduleType,
    String? scheduleTypeCode,
    String? dutyStartTime,
    String? dutyEndTime,
    String? totalDuration,
    int? createTime,
  }) {
    return DutyScheduleConfigEntity()
      ..id = id ?? this.id
      ..companyId = companyId ?? this.companyId
      ..companyName = companyName ?? this.companyName
      ..scheduleName = scheduleName ?? this.scheduleName
      ..scheduleType = scheduleType ?? this.scheduleType
      ..scheduleTypeCode = scheduleTypeCode ?? this.scheduleTypeCode
      ..dutyStartTime = dutyStartTime ?? this.dutyStartTime
      ..dutyEndTime = dutyEndTime ?? this.dutyEndTime
      ..totalDuration = totalDuration ?? this.totalDuration
      ..createTime = createTime ?? this.createTime;
  }
}